﻿using IBLL;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Model;

namespace WebApi.Controllers
{

    [Route("api/[controller]/[action]")]
    [ApiController]
    
    public class StoreController : ControllerBase,IStoreBLL
    {
        /// <summary>
        /// 注入IstoreBll
        /// </summary>
        /// <param name="storeBLL"></param>
        public StoreController(IStoreBLL storeBLL)
        {
            //创建属性并赋值
            StoreBLL = storeBLL;
        }

        public IStoreBLL StoreBLL { get; }
        /// <summary>
        /// 新增门店
        /// </summary>
        /// <param name="store">门店表</param>
        /// <returns>返回受影响行数</returns>
        [HttpPost]
        public async Task<int> AddStore(Store store)
        {
            return await StoreBLL.AddStore(store);
        }
        [HttpGet]
        public dynamic ShowStore(int aid, DateTime? time, int start, string? name = "")
        {
            return StoreBLL.ShowStore(aid, time, start, name);
        }
    }
}
